package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbContentMapper;
import com.dongdongshop.pojo.TbContent;
import com.dongdongshop.service.TbContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
@com.alibaba.dubbo.config.annotation.Service
public class TbContentServiceImpl implements TbContentService {

    @Autowired
    private TbContentMapper tbContentMapper;

    @Override
    public List<TbContent> selectss() {
        List<TbContent> tbContents = tbContentMapper.selectByExample(null);
        return tbContents;
    }

    @Override
    public boolean insert(TbContent tbContent) {
        int i = tbContentMapper.insertSelective(tbContent);
        return i>0;
    }

    @Override
    public void deleteByids(Long[] ids) {
        tbContentMapper.deleteByIds(ids);
    }

    @Override
    public TbContent selectByid(Long id) {
        TbContent tbContent = tbContentMapper.selectByPrimaryKey(id);
        return tbContent;
    }

    @Override
    public Boolean updata(TbContent tbContent) {
        int i = tbContentMapper.updateByPrimaryKeySelective(tbContent);
        return i>0;
    }

    @Override
    public List<TbContent> selectByCateId() {
        List<TbContent> tbContents = tbContentMapper.selectByCateId();
        return tbContents;
    }

    @Override
    public List<TbContent> selectRecommend() {
        return tbContentMapper.selectRecommend();
    }

    @Override
    public List<TbContent> favourite() {
        return tbContentMapper.favourite();
    }
}
